$(function(){
	$("#categoryForm").validate({
		lname: {
			 rule: {
				 maxlen:10,
				 required: true
			 },
			 error: {
				 maxlen: "不能大于10个字符 ",
		         required: "不能为空 "
		     },
		     message: "地区名称长度 1到 10 位 ",
		     success: "地区名称正确"
		 },
		 county: {
			 rule: {
				 required: true
			 },
			 error: {
		         required: "不能为空 "
		     },
		     message: "所属地区必须选择",
		     success: "正确"
		 },
		 sort: {
			 rule: {
				 num:"1,100",
				 required: true
			 },
			 error: {
				 num: "排序不能大于100 ",
		         required: "不能为空 "
		     },
		     message: "填写排序1~100之间的数字 ",
		     success: "排序填写正确"
		 }
	})
})


$(function(){
	$('select.user-add').change(function() {
	    var _select = $(this);
	    $.get(CONTROLLER+'/getCityItem',
	            {"cityid": _select.val()},
	            function(data) {
	            if (data) {
		            var _str = '<option value="">请选择</option>';
		            $.each(data, function(k, v) {
		                _str += '<option value="' + v.city_id + '">' + v.name + '</option>';
	            });
	            _select.nextAll().val('');
	            _select.next().html(_str);
	        }
	    }, 'JSON');
	});

});


$(function(){
	$('#county').change(function(){
		var county = $(this).val();
		$('#pid').val(county);
		
	});
});



















